# # from Crypto.PublicKey import RSA
# # from Crypto.Cipher import PKCS1_OAEP
# import base64
# rsa_key_pair = RSA.generate(1024)
# pubkey = rsa_key_pair.publickey().export_key()
# privkey = rsa_key_pair.export_key()
# print(pubkey.decode())
# print(privkey.decode())
#
# # 公钥加密
# text = "hello world"
# rsa_pubkey = RSA.import_key(pubkey)
# cipher_pub = PKCS1_OAEP.new(rsa_pubkey)
# ciphervalue_enc = base64.b64encode(cipher_pub.encrypt(text.encode("utf-8")))
# print("加密内容:\n{}".format(ciphervalue_enc.decode()))
#
# #私钥解密
# rsa_privkey = RSA.import_key(privkey)
# cipher_priv = PKCS1_OAEP.new(rsa_privkey)
# ciphervalue_dec = cipher_priv.decrypt(base64.b64decode(ciphervalue_enc))
# print("解密内容:\n{}".format(ciphervalue_dec.decode()))